
import Vue from 'vue';
module.exports = {
	//怪物经验公式
	monster_exp : (monster_lv) => {
		return Math.floor(25 * monster_lv * Math.log2(monster_lv + 1));
	},
	//角色升级经验公式
	player_level_exp : (player_lv) => {
		return 30 * (player_lv * player_lv * player_lv + 5 * player_lv) - 80
	},
	//强化成功率公式
	success_rate : (level) => {
		if (level % 10 >= 0 && level % 10 <= 8) {
		    return 100 - 6 * (level % 10);
		} else if (level % 10 === 9) {
		    return 30;
		} else {
		    return -1;
		}
	},
	//强化所需强化石公式
	need_strengthen_resource : (level) => {
		return {
			//stone : parseInt((level+1) / 10) + 1,
			stone : level+1,
			coin : (level+1) * 100
		}
	},
	//重铸成本公式
	need_recast_price : (qlty,equip_lv) => {
		let coin = 0;
		let diamond_stone = 0;
		if(parseInt(qlty) == 4){
			coin = 1000 * parseInt(qlty) * equip_lv * 2;
			diamond_stone = 1 * parseInt(qlty) * equip_lv * 2
		}else{
			coin = 1000 * parseInt(qlty) * equip_lv;
			diamond_stone = 1 * parseInt(qlty) * equip_lv
		}
		
		return {
			coin,
			diamond_stone
		}
	},
	//金币掉落公式
	coin_quantity : (monster_level) => {
		return Math.max(1,Vue.prototype.$common.rnd(parseInt(monster_level * 4),parseInt(monster_level * 6)))
	},
	//装备战力公式
	equip_power : (equipDataVolume) => {
		
		// "lv": 1,
		// "hp": 0,
		// "min_ac": 2,
		// "max_ac": 5,
		// "min_def": 0,
		// "max_def": 0,
		// "spd": 0,
		// "suck_blood": 0,
		// "exp_percent": 0,
		// "coin_percent": 0,
		// "fix_ac": 0,
		// "fix_def": 0,
		// "crit": 0,
		// "crit_percent": 0
		
		return parseInt(
		equipDataVolume.hp * 0.5 + 
		equipDataVolume.min_ac * 1 + 
		equipDataVolume.max_ac * 1 + 
		equipDataVolume.min_def * 0.8  + 
		equipDataVolume.max_def * 0.8 + 
		equipDataVolume.spd * 1.5 + 
		equipDataVolume.suck_blood * 1.7 + 
		equipDataVolume.exp_percent * 0.6 + 
		equipDataVolume.coin_percent * 0.6 + 
		equipDataVolume.fix_ac * 1.3 + 
		equipDataVolume.fix_def * 1.3 + 
		equipDataVolume.crit * 1.5 + 
		equipDataVolume.crit_percent * 1.3
		)
		
	}
}